<html>
  <head><title>Post testing</title></head>

  <script type="text/javascript" src="/media/js/jquery.js"></script>
<!--  <script type="text/javascript" src="/media/js/jquery.form.js"></script>-->

  <script type="text/javascript">
    $(document).ready(function() {
        $('#post_form').submit(function(event){
            event.preventDefault(); // cancel the default action
            var form = this;
            var data = {}
            data.post_data = $(form).find('input[@name=our_text]').val();
            // suppose our django app called 'testapp'
            $.post("/post_test/", 
                data, 
                function(responseData) {
                  alert(responseData.response_text);
                },
                "json"
            );
        });
    });
  </script>

  <body>
    <form id="post_form" method="post">
      Data to post: <input type="text" name="our_text" />
      <input type="submit" value="Add" />
    </form>
  </body>
</html>

